package kr.saeildamil.androidstudy.ch19;

import kr.saeildamil.androiddforstudy.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class RunnableTest extends Activity {
	
	int mMainValue;
	int mBackValue;
	
	TextView mMain;
	TextView mBack;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch19_threadtest);
		
		mMain = (TextView) findViewById(R.id.ch19_threadtest_maintv);
		mBack = (TextView) findViewById(R.id.ch19_threadtest_backtv);
	
		Thread thread = new Thread(new Runnable() {
			
			@Override
			public void run() {
				while (true) {
					mBackValue ++;
					try {
						Thread.sleep(1000);
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
				}
			}
		});
		thread.start();
		
	} // End of method onCreate;
	
	public void mOnClick(View v){
		mMainValue ++;
		mMain.setText("Main Value : " + mMainValue);
		mBack.setText("Back Value : " + mBackValue);
		
	} // End of method mOnClick;
}
